const express = require('express')
const router = express.Router()
const api = require('./apiFunction')

// 注册
router.post('/api/register', (req, res) => {
    api.register(req, res)
})

// 登陆
router.post('/api/login', (req, res) => {
    api.login(req, res)
})

// 获取首页数据
router.get('/api/getHomePageDate', (req, res) => {
    api.getHomePageDate(req, res)
})

// 查询作者信息
router.get('/api/getArouthInfo', (req, res) => {
    api.getArouthInfo(req, res)
})


// 获取一个帖子信息
router.get('/api/getPostsInfo', (req, res) => {
    api.getPostsInfo(req, res)
})

// 添加收藏和点赞
router.post('/api/addCollection', (req, res) => {
    api.addCollection(req, res)
})

// 增加浏览量
router.post('/api/addLook', (req, res) => {
    api.addLook(req, res)
})

// 获取用户点赞或收藏的数据
router.get('/api/getUserCollectOrCommitData', (req, res) => {
    api.getUserCollectOrCommitData(req, res)
})

// 取消点赞和收藏
router.post('/api/removeCollectionOrComment', (req, res) => {
    api.removeCollectionOrComment(req, res)
})

// 改变收藏点赞数量
router.post('/api/addCollectOrCommentNum', (req, res) => {
    api.addCollectOrCommentNum(req, res)
})


// 减少收藏点赞数
router.post('/api/removeCollectOrCommentNum', (req, res) => {
    api.removeCollectOrCommentNum(req, res)
})

// 模糊搜索
router.get('/api/search', (req, res) => {
    api.search(req, res)
})


// 添加评论
router.post('/api/sendAddCommentRequest', (req, res) => {
    api.sendAddCommentRequest(req, res)
})

// 获取评论
router.get('/api/getCommentList', (req, res) => {
    api.getCommentList(req, res)
})

// 删除评论
router.post('/api/delCommentList', (req, res) => {
    api.delCommentList(req, res)
})

// 获取用户资料
router.get('/api/getUserInfo', (req, res) => {
    api.getUserInfo(req, res)
})

// 添加帖子
router.post('/api/addPosts', (req, res) => {
    api.addPosts(req, res)
})

// 获取用户发布的信息
router.get('/api/Mysend', (req, res) => {
    api.Mysend(req, res)
})


// 删除用户发布的信息
router.post('/api/DelMySend', (req, res) => {
    api.DelMySend(req, res)
})

// 修改用户信息
router.post('/api/updateUserInfo', (req, res) => {
    api.updateUserInfo(req,res)
})
module.exports = router